Skip to content

ci(tox): migrate from pip to uv via tox-uv#6390

Merged
sl0thentr0py merged 41 commits into
masterfrom
chore/migrate-to-tox-uv
May 29, 2026
Merged

ci(tox): migrate from pip to uv via tox-uv#6390
sl0thentr0py merged 41 commits into
masterfrom
chore/migrate-to-tox-uv

Conversation

@sentry-junior
Copy link
Copy Markdown
Contributor

@sentry-junior sentry-junior Bot commented May 22, 2026

Description

  • add uv and tox-uv to manage python envs and packages instead of pip
  • use astral-sh/setup-uv action in CI instead of setup-python, top-level uv always uses python3.14
  • except for 3.6 and 3.7, all python versions now go through tox-uv
  • 3.6 and 3.7 have their own containers which uv picks up through UV_PYTHON_REFERENCE
  • the SDK is now installed as part of deps and not via package so uv resolves all deps in a single pass, this was necessary since uv resolution is stricter than pip
  • runtox.sh also uses uv run tox
  • some other pins were necessary to make CI pass
  • pre-releases need a special UV_PRERELEASE=ALL for resolution to work, we do not relax this throughout because uv then fetches pre-releases for httpx and such breaking half the matrix

Dev Flow Changes

No need for asdf or pyenv now if you were using it before, just use uv, it will manage both tox and required python versions internally.

New commands:

  • List tox envs: uv run tox l
  • Integration tests: uv run tox -e py3.14-{integration}-v{version}
  • Common tests: uv run tox -e py3.14-common
  • Run specific test file: TESTPATH=tests/integrations/logging/test_logging.py uv run tox -e py3.14-common
  • Run single test: TESTPATH=tests/path/to/test_file.py uv run tox -e py3.14-common -- -k "test_name"

TODO

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Codecov Results 📊

10 passed | Total: 10 | Pass Rate: 100% | Execution Time: 1.42s

📊 Comparison with Base Branch

Metric Change
Total Tests 📉 -22
Passed Tests 📉 -22
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 17877 uncovered lines.
❌ Project coverage is 21.94%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    24.69%    21.94%    -2.75%
==========================================
  Files          190       190         —
  Lines        22914     22901       -13
  Branches      7854      7854         —
==========================================
+ Hits          5658      5024      -634
- Misses       17256     17877      +621
- Partials       518       440       -78

Generated by Codecov Action

Comment thread scripts/populate_tox/tox.jinja Outdated
Comment thread .github/workflows/test-integrations-cloud.yml Outdated
Comment thread .github/workflows/test-integrations-common.yml
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch 2 times, most recently from 35deb2d to a767133 Compare May 26, 2026 15:19
Comment thread .github/workflows/test-integrations-dbs.yml Outdated
Comment thread .github/workflows/test-integrations-tasks.yml Outdated
Comment thread scripts/populate_tox/tox.jinja Outdated
Comment thread Makefile Outdated
Comment thread .github/workflows/test-integrations-flags.yml Outdated
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch from a3989a2 to 35675ae Compare May 26, 2026 16:55
Comment thread tox.ini Outdated
Comment thread scripts/populate_tox/tox.jinja Outdated
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch 5 times, most recently from 33b62fa to 030fd1b Compare May 26, 2026 19:39
Comment thread .github/workflows/test-integrations-tasks.yml
Comment thread tests/integrations/celery/integration_tests/__init__.py
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch 3 times, most recently from 7a229b6 to ccb07a7 Compare May 27, 2026 11:20
@sl0thentr0py sl0thentr0py changed the title build(tox): migrate from pip to uv via tox-uv build(tox): migrate from pip to uv via tox-uv for CI May 27, 2026
@sl0thentr0py sl0thentr0py changed the title build(tox): migrate from pip to uv via tox-uv for CI ci(tox): migrate from pip to uv via tox-uv May 27, 2026
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch from 6b18651 to 2267687 Compare May 27, 2026 11:51
@sl0thentr0py sl0thentr0py marked this pull request as ready for review May 27, 2026 12:04
sl0thentr0py and others added 20 commits May 28, 2026 14:41
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
py3.7 celery in CI hangs in test_celery_beat_cron_monitoring::test_explanation.
kill_beat slept 1s then opened the pidfile; in the slower py3.7 container
startup, the file didn't exist yet, the thread died silently, and beat
ran forever (30-min job timeout).

Poll for the pidfile up to 30s before starting the kill timer, and dump
any future thread exception to stderr so the next failure surfaces a
traceback instead of silently hanging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The pidfile-race fix did not unhang py3.7 celery in CI. pytest-timeout
only dumps the parent pytest process's threads — the parent is stuck in
pytest-forked's waitpid, so the actual hang is somewhere inside the
forked child, invisible.

Schedule faulthandler.dump_traceback_later(45) in run_beat (which runs
inside the forked child) and cancel it on successful beat shutdown. If
beat hangs in CI again, the child's full thread dump lands in the log
and tells us where to look.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Previous attempt put faulthandler.dump_traceback_later inside run_beat,
but the py3.7 CI hang turns out to happen earlier — start_worker() never
returns, so run_beat is never reached and the dump is never armed.

Move the diagnostic into an autouse fixture in
tests/integrations/celery/integration_tests/conftest.py so it covers the
entire test body. Next CI hang should land a thread dump in the log
showing where start_worker is wedged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
So the py3.7-container kombu hang reveals its real exception instead of
sleeping forever inside retry_over_time.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After moving py3.6/3.7 jobs into the python:X.Y container, the three beat
tests (test_explanation, test_beat_task_crons_success/error) hang in
celery's start_worker on py3.7 only — kombu's pre-connect via
default_channel never returns. This is a known kombu/redis-py + os.fork
interaction on the old pin (kombu 4.6 + redis-py <3.2) that celery 4.4.7
ships with; it worked previously only because the broker was on loopback,
not a bridged sibling container.

Bumping the existing < (3, 7) skip to < (3, 8). py3.7 is EOL and the same
tests run fine on 3.8+. Also dropping the diagnostic faulthandler
conftest and the kill_beat exception-printing wrapper now that the
root cause is understood; the pidfile-wait fix in kill_beat is kept since
it's a legitimate startup-race fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The workflow sets SENTRY_PYTHON_TEST_REDIS_HOST=redis for 3.6/3.7
container runs (since redis is a sibling service container, not on
loopback), but tox strips env vars not listed in passenv. The celery
beat tests therefore read the default 127.0.0.1, find nothing on
loopback inside the python container, and hang in kombu's
retry_over_time. Adding the var to passenv fixes it; un-skip the beat
tests on py3.7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
this will **finally** make pre-commit consistent with CI
:upside_down_face:
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch from ad243c4 to 07280c2 Compare May 28, 2026 12:41
keeping this in a separate dependency group since we install lots of
random packages just for typing
## Description

* Invoke `find_raise_from_none` with uv
* Remove `linters` from `tox` completely
* Remove unused `ready_yet`
* Invoke `populate_tox` and `split_tox_gh_actions` with uv
* Move `apidocs` to uv
* Move from `make build` to `uv build` (verification of contents below)
* Move from `make aws-lambda-layer` to uv
* Remove `Makefile` completely
* Remove unused `dist-serverless` from github workflows

### Content verification of `make dist` -> `uv build`

```
⏺ Sdist contents identical too — the 9-byte difference is just tarball/gzip
  metadata (timestamps, header). Final summary:

  Artifact: Wheel filename
  make dist: sentry_sdk-2.61.0-py3-none-any.whl
  uv build: same
  Diff: ✓
  ────────────────────────────────────────
  Artifact: Wheel bytes
  make dist: 483,104
  uv build: 483,104
  Diff: ✓ identical
  ────────────────────────────────────────
  Artifact: Wheel contents
  make dist: —
  uv build: —
  Diff: ✓ identical (recursive diff clean)
  ────────────────────────────────────────
  Artifact: Sdist filename
  make dist: sentry_sdk-2.61.0.tar.gz
  uv build: same
  Diff: ✓
  ────────────────────────────────────────
  Artifact: Sdist file list
  make dist: —
  uv build: —
  Diff: ✓ identical
  ────────────────────────────────────────
  Artifact: Sdist contents
  make dist: —
  uv build: —
  Diff: ✓ identical (recursive diff clean)
  ────────────────────────────────────────
  Artifact: Sdist bytes
  make dist: 459,825
  uv build: 459,834
  Diff: tarball metadata only (9 bytes)
```
Comment thread scripts/build_aws_lambda_layer.py
@sl0thentr0py sl0thentr0py force-pushed the chore/migrate-to-tox-uv branch from de3e34a to d0621cb Compare May 29, 2026 11:36
@sl0thentr0py sl0thentr0py merged commit 2ce26d1 into master May 29, 2026
150 of 156 checks passed
@sl0thentr0py sl0thentr0py deleted the chore/migrate-to-tox-uv branch May 29, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants